package com.tree;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author:hanguanglei
 * @Description:
 * @Date: Created in 2020-10-07 13:49
 * @Modified By:
 */

public class TreeNode {

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof TreeNode)) return false;

        TreeNode treeNode = (TreeNode) o;

        if (!nodeName.equals(treeNode.nodeName)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return nodeName.hashCode();
    }

    private String nodeName;
    private List<TreeNode> childLst;

    public TreeNode(String nodeName, List<TreeNode> childLst) {
        this.nodeName = nodeName;
        this.childLst = childLst;
    }

    public TreeNode(String nodeName) {
        this.nodeName = nodeName;
        this.childLst=new ArrayList<TreeNode>();
    }
    public void addNode(TreeNode node)
    {
        this.childLst.add(node);
    }

    public String getNodeName() {
        return nodeName;
    }

    public void setNodeName(String nodeName) {
        this.nodeName = nodeName;
    }

    public List<TreeNode> getChildLst() {
        return childLst;
    }

    public void setChildLst(List<TreeNode> childLst) {
        this.childLst = childLst;
    }

}
